<?php
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . "/js/dist/js/jquery.bootstrap-duallistbox.js");
Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . "/css/dist/css/bootstrap-duallistbox.min.css");

$this->breadcrumbs = array(
    '推荐内容管理' => array('/advice/adviceContent'),
    '关联内容'
);
?>
<div class="row" style="min-height:300px;background-color:#fff;">
    <?php

    $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
        'id' => 'CreateForm',
        'action' => 'link?id=' . $model->id,
        'type' => 'horizontal',
        'enableAjaxValidation' => false,
        'enableClientValidation' => true,
        'clientOptions' => array(
            'validateOnSubmit' => true,
        ),
    ));

    if ($form instanceof TbActiveForm) {

    }

    ?>
    <blockquote><b>已关联视频</b></blockquote>
    <div class="col-md-12">
        <?php
        echo $form->hiddenField($model, 'id');
        ?>

    </div>
    <div class="col-md-12 col-xs-12">
        <?=
        CHtml::activeDropDownList($model, 'extids', Video::getOptions('videos'),
            ['id'=>'linkvids','multiple' => true,'data-select' => 'dual']);
        ?>
    </div>
    <div class="col-md-12 col-xs-12">
        <?= CHtml::submitButton('关联', ['class' => 'btn btn-primary btn-submit']) ?>
    </div>
    <?php
    $this->endWidget();
    ?>
</div>
<script>
    $("#linkvids").bootstrapDualListbox({
        nonSelectedListLabel: '可选择视频',
        selectedListLabel: '已经选择视频',
        preserveSelectionOnMove: 'moved',
    });

</script>


